package com.qingke.oo;

public class MyPoint {
	private int x = 0;
	private int y = 0;
	
	public MyPoint(){
		
	}
	
	public MyPoint(int x,int y){
		this.x = x;
		this.y = y;
	}
	
	public int getX(){
		return x;
	}
	
	public void setX(int x){
		this.x = x;
	}
	
	public int getY(){
		return y;
	}
	
	public void setY(int y){
		this.y =y;
	}
	
	public int[] getXY(){
		int[] i = {x,y};
		return i;
	}
	
	public void setXY(int x,int y){
		this.x = x;
		this.y = y;
	}
	
	public String toString(){
		return "("+x+","+y+")";
	}
	
	public double distance(int x,int y){
		return Math.sqrt((x-this.x)*(x-this.x)+(y-this.y)*(y-this.y));
	}
	
	public double distance(MyPoint another){
		return Math.sqrt((another.x-this.x)*(another.x-this.x)+(another.y-this.y)*(another.y-this.y));
	}
	
	public double distance(){
		return Math.sqrt(this.x*this.x+this.y*this.y);
	}	
	
	public static void main(String[]args){
		MyPoint[] m = new MyPoint[10];
		for(int i=0;i<10;i++){
			m[i] = new MyPoint(i+1,i+1);
			System.out.println(m[i]);
		}
		
		System.out.println(m[(int)(Math.random()*10)].toString());
	}
}




